{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "provenance": [],
      "toc_visible": true,
      "authorship_tag": "ABX9TyNJAdha/v4n9zLqIfGakg0E"
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "language_info": {
      "name": "python"
    }
  },
  "cells": [
    {
      "cell_type": "markdown",
      "source": [
        "# Install Evidently and DVC with DVCLive"
      ],
      "metadata": {
        "id": "WpfOFaqHcnAt"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "Run on Google Colab"
      ],
      "metadata": {
        "id": "WpfOFaqHcnAs"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "!pip uninstall -q -y sqlalchemy pyarrow ipython-sql pandas-gbq"
      ],
      "metadata": {
        "id": "BqWpagFPZ45W",
        "executionInfo": {
          "status": "ok",
          "timestamp": 1697468096427,
          "user_tz": -120,
          "elapsed": 2337,
          "user": {
            "displayName": "Francesco Motoko",
            "userId": "00974636158007469548"
          }
        }
      },
      "execution_count": 1,
      "outputs": []
    },
    {
      "cell_type": "code",
      "execution_count": 2,
      "metadata": {
        "id": "DijzqeokW595",
        "executionInfo": {
          "status": "ok",
          "timestamp": 1697468130037,
          "user_tz": -120,
          "elapsed": 33615,
          "user": {
            "displayName": "Francesco Motoko",
            "userId": "00974636158007469548"
          }
        }
      },
      "outputs": [],
      "source": [
        "%%capture\n",
        "!pip install -q dvc==3.25.0 dvclive==3.0.1 evidently==0.4.5 pandas==1.5.3"
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "# Load the data"
      ],
      "metadata": {
        "id": "ZyZ2sX8GcvMU"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "!mkdir raw_data && \\\n",
        " cd raw_data && \\\n",
        " wget https://archive.ics.uci.edu/static/public/275/bike+sharing+dataset.zip && \\\n",
        " unzip bike+sharing+dataset.zip"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "ZUrB0D59XMDD",
        "executionInfo": {
          "status": "ok",
          "timestamp": 1697468131788,
          "user_tz": -120,
          "elapsed": 1772,
          "user": {
            "displayName": "Francesco Motoko",
            "userId": "00974636158007469548"
          }
        },
        "outputId": "9f6f5a3c-f856-4d56-a8fb-ec4483ec6127"
      },
      "execution_count": 3,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "--2023-10-16 14:55:29--  https://archive.ics.uci.edu/static/public/275/bike+sharing+dataset.zip\n",
            "Resolving archive.ics.uci.edu (archive.ics.uci.edu)... 128.195.10.252\n",
            "Connecting to archive.ics.uci.edu (archive.ics.uci.edu)|128.195.10.252|:443... connected.\n",
            "HTTP request sent, awaiting response... 200 OK\n",
            "Length: unspecified\n",
            "Saving to: ‘bike+sharing+dataset.zip’\n",
            "\n",
            "bike+sharing+datase     [   <=>              ] 273.43K   443KB/s    in 0.6s    \n",
            "\n",
            "2023-10-16 14:55:30 (443 KB/s) - ‘bike+sharing+dataset.zip’ saved [279992]\n",
            "\n",
            "Archive:  bike+sharing+dataset.zip\n",
            "  inflating: Readme.txt              \n",
            "  inflating: day.csv                 \n",
            "  inflating: hour.csv                \n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "import pandas as pd"
      ],
      "metadata": {
        "id": "P3XXcUrQY1EQ",
        "executionInfo": {
          "status": "ok",
          "timestamp": 1697468132141,
          "user_tz": -120,
          "elapsed": 357,
          "user": {
            "displayName": "Francesco Motoko",
            "userId": "00974636158007469548"
          }
        }
      },
      "execution_count": 4,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "df = pd.read_csv(\"raw_data/day.csv\", header=0, sep=',', parse_dates=['dteday'])\n",
        "df.head()"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 206
        },
        "id": "MDK0xkdbYCWg",
        "executionInfo": {
          "status": "ok",
          "timestamp": 1697468132141,
          "user_tz": -120,
          "elapsed": 9,
          "user": {
            "displayName": "Francesco Motoko",
            "userId": "00974636158007469548"
          }
        },
        "outputId": "ec8d2605-144d-45ff-b442-70ba858a44a3"
      },
      "execution_count": 5,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "   instant     dteday  season  yr  mnth  holiday  weekday  workingday  \\\n",
              "0        1 2011-01-01       1   0     1        0        6           0   \n",
              "1        2 2011-01-02       1   0     1        0        0           0   \n",
              "2        3 2011-01-03       1   0     1        0        1           1   \n",
              "3        4 2011-01-04       1   0     1        0        2           1   \n",
              "4        5 2011-01-05       1   0     1        0        3           1   \n",
              "\n",
              "   weathersit      temp     atemp       hum  windspeed  casual  registered  \\\n",
              "0           2  0.344167  0.363625  0.805833   0.160446     331         654   \n",
              "1           2  0.363478  0.353739  0.696087   0.248539     131         670   \n",
              "2           1  0.196364  0.189405  0.437273   0.248309     120        1229   \n",
              "3           1  0.200000  0.212122  0.590435   0.160296     108        1454   \n",
              "4           1  0.226957  0.229270  0.436957   0.186900      82        1518   \n",
              "\n",
              "    cnt  \n",
              "0   985  \n",
              "1   801  \n",
              "2  1349  \n",
              "3  1562  \n",
              "4  1600  "
            ],
            "text/html": [
              "\n",
              "  <div id=\"df-f57eeeda-2494-42a9-8d15-33081c4de93d\" class=\"colab-df-container\">\n",
              "    <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>instant</th>\n",
              "      <th>dteday</th>\n",
              "      <th>season</th>\n",
              "      <th>yr</th>\n",
              "      <th>mnth</th>\n",
              "      <th>holiday</th>\n",
              "      <th>weekday</th>\n",
              "      <th>workingday</th>\n",
              "      <th>weathersit</th>\n",
              "      <th>temp</th>\n",
              "      <th>atemp</th>\n",
              "      <th>hum</th>\n",
              "      <th>windspeed</th>\n",
              "      <th>casual</th>\n",
              "      <th>registered</th>\n",
              "      <th>cnt</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>1</td>\n",
              "      <td>2011-01-01</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>6</td>\n",
              "      <td>0</td>\n",
              "      <td>2</td>\n",
              "      <td>0.344167</td>\n",
              "      <td>0.363625</td>\n",
              "      <td>0.805833</td>\n",
              "      <td>0.160446</td>\n",
              "      <td>331</td>\n",
              "      <td>654</td>\n",
              "      <td>985</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>2</td>\n",
              "      <td>2011-01-02</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>2</td>\n",
              "      <td>0.363478</td>\n",
              "      <td>0.353739</td>\n",
              "      <td>0.696087</td>\n",
              "      <td>0.248539</td>\n",
              "      <td>131</td>\n",
              "      <td>670</td>\n",
              "      <td>801</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>3</td>\n",
              "      <td>2011-01-03</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>0.196364</td>\n",
              "      <td>0.189405</td>\n",
              "      <td>0.437273</td>\n",
              "      <td>0.248309</td>\n",
              "      <td>120</td>\n",
              "      <td>1229</td>\n",
              "      <td>1349</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>4</td>\n",
              "      <td>2011-01-04</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>2</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>0.200000</td>\n",
              "      <td>0.212122</td>\n",
              "      <td>0.590435</td>\n",
              "      <td>0.160296</td>\n",
              "      <td>108</td>\n",
              "      <td>1454</td>\n",
              "      <td>1562</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>5</td>\n",
              "      <td>2011-01-05</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>3</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>0.226957</td>\n",
              "      <td>0.229270</td>\n",
              "      <td>0.436957</td>\n",
              "      <td>0.186900</td>\n",
              "      <td>82</td>\n",
              "      <td>1518</td>\n",
              "      <td>1600</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>\n",
              "    <div class=\"colab-df-buttons\">\n",
              "\n",
              "  <div class=\"colab-df-container\">\n",
              "    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-f57eeeda-2494-42a9-8d15-33081c4de93d')\"\n",
              "            title=\"Convert this dataframe to an interactive table.\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n",
              "    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n",
              "  </svg>\n",
              "    </button>\n",
              "\n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    .colab-df-buttons div {\n",
              "      margin-bottom: 4px;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "    <script>\n",
              "      const buttonEl =\n",
              "        document.querySelector('#df-f57eeeda-2494-42a9-8d15-33081c4de93d button.colab-df-convert');\n",
              "      buttonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "      async function convertToInteractive(key) {\n",
              "        const element = document.querySelector('#df-f57eeeda-2494-42a9-8d15-33081c4de93d');\n",
              "        const dataTable =\n",
              "          await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                    [key], {});\n",
              "        if (!dataTable) return;\n",
              "\n",
              "        const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "          + ' to learn more about interactive tables.';\n",
              "        element.innerHTML = '';\n",
              "        dataTable['output_type'] = 'display_data';\n",
              "        await google.colab.output.renderOutput(dataTable, element);\n",
              "        const docLink = document.createElement('div');\n",
              "        docLink.innerHTML = docLinkHtml;\n",
              "        element.appendChild(docLink);\n",
              "      }\n",
              "    </script>\n",
              "  </div>\n",
              "\n",
              "\n",
              "<div id=\"df-1a8f4885-5b57-4a9a-bfc7-8d551bb879a7\">\n",
              "  <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-1a8f4885-5b57-4a9a-bfc7-8d551bb879a7')\"\n",
              "            title=\"Suggest charts.\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "     width=\"24px\">\n",
              "    <g>\n",
              "        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n",
              "    </g>\n",
              "</svg>\n",
              "  </button>\n",
              "\n",
              "<style>\n",
              "  .colab-df-quickchart {\n",
              "      --bg-color: #E8F0FE;\n",
              "      --fill-color: #1967D2;\n",
              "      --hover-bg-color: #E2EBFA;\n",
              "      --hover-fill-color: #174EA6;\n",
              "      --disabled-fill-color: #AAA;\n",
              "      --disabled-bg-color: #DDD;\n",
              "  }\n",
              "\n",
              "  [theme=dark] .colab-df-quickchart {\n",
              "      --bg-color: #3B4455;\n",
              "      --fill-color: #D2E3FC;\n",
              "      --hover-bg-color: #434B5C;\n",
              "      --hover-fill-color: #FFFFFF;\n",
              "      --disabled-bg-color: #3B4455;\n",
              "      --disabled-fill-color: #666;\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart {\n",
              "    background-color: var(--bg-color);\n",
              "    border: none;\n",
              "    border-radius: 50%;\n",
              "    cursor: pointer;\n",
              "    display: none;\n",
              "    fill: var(--fill-color);\n",
              "    height: 32px;\n",
              "    padding: 0;\n",
              "    width: 32px;\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart:hover {\n",
              "    background-color: var(--hover-bg-color);\n",
              "    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "    fill: var(--button-hover-fill-color);\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart-complete:disabled,\n",
              "  .colab-df-quickchart-complete:disabled:hover {\n",
              "    background-color: var(--disabled-bg-color);\n",
              "    fill: var(--disabled-fill-color);\n",
              "    box-shadow: none;\n",
              "  }\n",
              "\n",
              "  .colab-df-spinner {\n",
              "    border: 2px solid var(--fill-color);\n",
              "    border-color: transparent;\n",
              "    border-bottom-color: var(--fill-color);\n",
              "    animation:\n",
              "      spin 1s steps(1) infinite;\n",
              "  }\n",
              "\n",
              "  @keyframes spin {\n",
              "    0% {\n",
              "      border-color: transparent;\n",
              "      border-bottom-color: var(--fill-color);\n",
              "      border-left-color: var(--fill-color);\n",
              "    }\n",
              "    20% {\n",
              "      border-color: transparent;\n",
              "      border-left-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "    }\n",
              "    30% {\n",
              "      border-color: transparent;\n",
              "      border-left-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "      border-right-color: var(--fill-color);\n",
              "    }\n",
              "    40% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "    }\n",
              "    60% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "    }\n",
              "    80% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "      border-bottom-color: var(--fill-color);\n",
              "    }\n",
              "    90% {\n",
              "      border-color: transparent;\n",
              "      border-bottom-color: var(--fill-color);\n",
              "    }\n",
              "  }\n",
              "</style>\n",
              "\n",
              "  <script>\n",
              "    async function quickchart(key) {\n",
              "      const quickchartButtonEl =\n",
              "        document.querySelector('#' + key + ' button');\n",
              "      quickchartButtonEl.disabled = true;  // To prevent multiple clicks.\n",
              "      quickchartButtonEl.classList.add('colab-df-spinner');\n",
              "      try {\n",
              "        const charts = await google.colab.kernel.invokeFunction(\n",
              "            'suggestCharts', [key], {});\n",
              "      } catch (error) {\n",
              "        console.error('Error during call to suggestCharts:', error);\n",
              "      }\n",
              "      quickchartButtonEl.classList.remove('colab-df-spinner');\n",
              "      quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n",
              "    }\n",
              "    (() => {\n",
              "      let quickchartButtonEl =\n",
              "        document.querySelector('#df-1a8f4885-5b57-4a9a-bfc7-8d551bb879a7 button');\n",
              "      quickchartButtonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "    })();\n",
              "  </script>\n",
              "</div>\n",
              "    </div>\n",
              "  </div>\n"
            ]
          },
          "metadata": {},
          "execution_count": 5
        }
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "# Define column mapping"
      ],
      "metadata": {
        "id": "4a9DrmjyhhEP"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "from evidently.pipeline.column_mapping import ColumnMapping"
      ],
      "metadata": {
        "id": "_bkEZuM8gELe",
        "executionInfo": {
          "status": "ok",
          "timestamp": 1697468132141,
          "user_tz": -120,
          "elapsed": 5,
          "user": {
            "displayName": "Francesco Motoko",
            "userId": "00974636158007469548"
          }
        }
      },
      "execution_count": 6,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "data_columns = ColumnMapping()\n",
        "data_columns.numerical_features = ['weathersit', 'temp', 'atemp', 'hum', 'windspeed']\n",
        "data_columns.categorical_features = ['holiday', 'workingday']"
      ],
      "metadata": {
        "id": "dLIZqkHAgEuo",
        "executionInfo": {
          "status": "ok",
          "timestamp": 1697468132141,
          "user_tz": -120,
          "elapsed": 5,
          "user": {
            "displayName": "Francesco Motoko",
            "userId": "00974636158007469548"
          }
        }
      },
      "execution_count": 7,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "source": [
        "# Define what to log"
      ],
      "metadata": {
        "id": "yNBKbk51hpyz"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "from evidently.report import Report\n",
        "from evidently.metric_preset import DataDriftPreset"
      ],
      "metadata": {
        "id": "owblpS3Ahw0o",
        "executionInfo": {
          "status": "ok",
          "timestamp": 1697468136565,
          "user_tz": -120,
          "elapsed": 4428,
          "user": {
            "displayName": "Francesco Motoko",
            "userId": "00974636158007469548"
          }
        }
      },
      "execution_count": 8,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "def eval_drift(reference, production, column_mapping):\n",
        "    data_drift_report = Report(metrics=[DataDriftPreset()])\n",
        "    data_drift_report.run(\n",
        "        reference_data=reference, current_data=production, column_mapping=column_mapping\n",
        "    )\n",
        "    report = data_drift_report.as_dict()\n",
        "\n",
        "    drifts = []\n",
        "\n",
        "    for feature in (\n",
        "        column_mapping.numerical_features + column_mapping.categorical_features\n",
        "    ):\n",
        "        drifts.append(\n",
        "            (\n",
        "                feature,\n",
        "                report[\"metrics\"][1][\"result\"][\"drift_by_columns\"][feature][\n",
        "                    \"drift_score\"\n",
        "                ],\n",
        "            )\n",
        "        )\n",
        "\n",
        "    return drifts\n"
      ],
      "metadata": {
        "id": "vRF8PjiYho6z",
        "executionInfo": {
          "status": "ok",
          "timestamp": 1697468136565,
          "user_tz": -120,
          "elapsed": 3,
          "user": {
            "displayName": "Francesco Motoko",
            "userId": "00974636158007469548"
          }
        }
      },
      "execution_count": 9,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "source": [
        "# Define the comparison windows"
      ],
      "metadata": {
        "id": "4Yhet51mh6Xz"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "#set reference dates\n",
        "reference_dates = ('2011-01-01 00:00:00','2011-01-28 23:00:00')\n",
        "\n",
        "#set experiment batches dates\n",
        "experiment_batches = [\n",
        "    ('2011-01-01 00:00:00','2011-01-29 23:00:00'),\n",
        "    ('2011-01-29 00:00:00','2011-02-07 23:00:00'),\n",
        "    ('2011-02-07 00:00:00','2011-02-14 23:00:00'),\n",
        "    ('2011-02-15 00:00:00','2011-02-21 23:00:00'),\n",
        "]"
      ],
      "metadata": {
        "id": "nTq8xUbGh3Ux",
        "executionInfo": {
          "status": "ok",
          "timestamp": 1697468136565,
          "user_tz": -120,
          "elapsed": 3,
          "user": {
            "displayName": "Francesco Motoko",
            "userId": "00974636158007469548"
          }
        }
      },
      "execution_count": 10,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "source": [
        "# Run and log experiments with DVCLive"
      ],
      "metadata": {
        "id": "8lNq9OdniDss"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "!git config --global user.email \"you@example.com\"\n",
        "!git config --global user.name \"Your Name\""
      ],
      "metadata": {
        "id": "zUt5jrVSRIqD",
        "executionInfo": {
          "status": "ok",
          "timestamp": 1697468136565,
          "user_tz": -120,
          "elapsed": 3,
          "user": {
            "displayName": "Francesco Motoko",
            "userId": "00974636158007469548"
          }
        }
      },
      "execution_count": 11,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "from dvclive import Live"
      ],
      "metadata": {
        "id": "5Hx1jI9PnT3C",
        "executionInfo": {
          "status": "ok",
          "timestamp": 1697468137794,
          "user_tz": -120,
          "elapsed": 1231,
          "user": {
            "displayName": "Francesco Motoko",
            "userId": "00974636158007469548"
          }
        }
      },
      "execution_count": 12,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "source": [
        "There are two ways to use DVC, put all the drift evaluation steps in one single experiment (corresponding to a git commit), or to save each step as a separate experiment (git commit)"
      ],
      "metadata": {
        "id": "jTsrtISaSF7D"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "## In one experiment"
      ],
      "metadata": {
        "id": "RGrEbbla30jr"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "# Setup a git repo with dvc\n",
        "\n",
        "%cd /content\n",
        "!rm -rf experiments && mkdir experiments\n",
        "%cd experiments\n",
        "\n",
        "!git init\n",
        "!git add .gitignore\n",
        "!git commit -m \"Init repo\"\n",
        "!dvc init\n",
        "!git commit -m \"Init DVC\""
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "ijUf_HhRobl0",
        "executionInfo": {
          "status": "ok",
          "timestamp": 1697468140631,
          "user_tz": -120,
          "elapsed": 2844,
          "user": {
            "displayName": "Francesco Motoko",
            "userId": "00974636158007469548"
          }
        },
        "outputId": "796d7eec-17dc-40b2-a4c9-5bdcf9184c58"
      },
      "execution_count": 13,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "/content\n",
            "/content/experiments\n",
            "hint: Using 'master' as the name for the initial branch. This default branch name\n",
            "hint: is subject to change. To configure the initial branch name to use in all\n",
            "hint: of your new repositories, which will suppress this warning, call:\n",
            "hint: \n",
            "hint: \tgit config --global init.defaultBranch <name>\n",
            "hint: \n",
            "hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and\n",
            "hint: 'development'. The just-created branch can be renamed via this command:\n",
            "hint: \n",
            "hint: \tgit branch -m <name>\n",
            "Initialized empty Git repository in /content/experiments/.git/\n",
            "fatal: pathspec '.gitignore' did not match any files\n",
            "On branch master\n",
            "\n",
            "Initial commit\n",
            "\n",
            "nothing to commit (create/copy files and use \"git add\" to track)\n",
            "Initialized DVC repository.\n",
            "\n",
            "You can now commit the changes to git.\n",
            "\n",
            "+---------------------------------------------------------------------+\n",
            "|                                                                     |\n",
            "|        DVC has enabled anonymous aggregate usage analytics.         |\n",
            "|     Read the analytics documentation (and how to opt-out) here:     |\n",
            "|             <https://dvc.org/doc/user-guide/analytics>              |\n",
            "|                                                                     |\n",
            "+---------------------------------------------------------------------+\n",
            "\n",
            "What's next?\n",
            "------------\n",
            "- Check out the documentation: <https://dvc.org/doc>\n",
            "- Get help and share ideas: <https://dvc.org/chat>\n",
            "- Star us on GitHub: <https://github.com/iterative/dvc>\n",
            "[master (root-commit) 9220260] Init DVC\n",
            " 3 files changed, 6 insertions(+)\n",
            " create mode 100644 .dvc/.gitignore\n",
            " create mode 100644 .dvc/config\n",
            " create mode 100644 .dvcignore\n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "with Live(report=\"notebook\") as live:\n",
        "    for date in experiment_batches:\n",
        "        live.log_param(\"begin\", date[0])\n",
        "        live.log_param(\"end\", date[1])\n",
        "\n",
        "        metrics = eval_drift(\n",
        "            df.loc[df.dteday.between(reference_dates[0], reference_dates[1])],\n",
        "            df.loc[df.dteday.between(date[0], date[1])],\n",
        "            column_mapping=data_columns,\n",
        "        )\n",
        "\n",
        "        for feature in metrics:\n",
        "            live.log_metric(feature[0], round(feature[1], 3))\n",
        "\n",
        "        live.next_step()"
      ],
      "metadata": {
        "id": "_h-jGJqPiA30",
        "executionInfo": {
          "status": "ok",
          "timestamp": 1697468156663,
          "user_tz": -120,
          "elapsed": 16055,
          "user": {
            "displayName": "Francesco Motoko",
            "userId": "00974636158007469548"
          }
        },
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 1000
        },
        "outputId": "0b949e24-8c53-4765-a8ee-64d002b3801e"
      },
      "execution_count": 14,
      "outputs": [
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<IPython.core.display.Markdown object>"
            ],
            "text/markdown": "# DVC Report\n\nparams.yaml\n\n| begin               | end                 |\n|---------------------|---------------------|\n| 2011-02-15 00:00:00 | 2011-02-21 23:00:00 |\n\nmetrics.json\n\n|   weathersit |   temp |   atemp |   hum |   windspeed |   holiday |   workingday |   step |\n|--------------|--------|---------|-------|-------------|-----------|--------------|--------|\n|        0.231 |      0 |       0 | 0.062 |       0.012 |     0.275 |        0.593 |      3 |\n\n![static/holiday]()\n\n![static/windspeed]()\n\n![static/temp]()\n\n![static/workingday]()\n\n![static/weathersit]()\n\n![static/hum]()\n\n![static/atemp]()\n"
          },
          "metadata": {}
        }
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "To explore the results from CLI:"
      ],
      "metadata": {
        "id": "Pc3jDX1q-y3c"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "!dvc plots show"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "6OAsURiL-Ge2",
        "executionInfo": {
          "status": "ok",
          "timestamp": 1697468158085,
          "user_tz": -120,
          "elapsed": 1434,
          "user": {
            "displayName": "Francesco Motoko",
            "userId": "00974636158007469548"
          }
        },
        "outputId": "0fb47be1-f524-41f1-8c74-d4663d721290"
      },
      "execution_count": 15,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "\rReading plot's data from workspace:   0% 0/7 [00:00<?, ?files/s]\rReading plot's data from workspace:   0% 0/7 [00:00<?, ?files/s{'info': ''}]\r                                                                            \rfile:///content/experiments/dvc_plots/index.html\n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "import IPython\n",
        "IPython.display.HTML(filename='dvc_plots/index.html')"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 802
        },
        "id": "pwdjxeEG-I49",
        "executionInfo": {
          "status": "ok",
          "timestamp": 1697468158085,
          "user_tz": -120,
          "elapsed": 4,
          "user": {
            "displayName": "Francesco Motoko",
            "userId": "00974636158007469548"
          }
        },
        "outputId": "e01c74f9-45b6-4715-b1bd-2dd20875a421"
      },
      "execution_count": 16,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "<IPython.core.display.HTML object>"
            ],
            "text/html": [
              "<!DOCTYPE html>\n",
              "<html>\n",
              "<head>\n",
              "    \n",
              "    <title>DVC Plot</title>\n",
              "    \n",
              "\n",
              "    <script src=\"https://cdn.jsdelivr.net/npm/vega@5.20.2\"></script>\n",
              "    <script src=\"https://cdn.jsdelivr.net/npm/vega-lite@5.2.0\"></script>\n",
              "    <script src=\"https://cdn.jsdelivr.net/npm/vega-embed@6.18.2\"></script>\n",
              "    \n",
              "    <style>\n",
              "        table {\n",
              "            border-spacing: 15px;\n",
              "        }\n",
              "    </style>\n",
              "</head>\n",
              "<body>\n",
              "    \n",
              "    <div id = \"dvclive_plots_metrics_atemp_tsv\">\n",
              "        <script type = \"text/javascript\">\n",
              "            var spec = {\"$schema\": \"https://vega.github.io/schema/vega-lite/v5.json\", \"data\": {\"values\": [{\"step\": \"0\", \"atemp\": \"1.0\", \"rev\": \"workspace\"}, {\"step\": \"1\", \"atemp\": \"0.107\", \"rev\": \"workspace\"}, {\"step\": \"2\", \"atemp\": \"0.537\", \"rev\": \"workspace\"}, {\"step\": \"3\", \"atemp\": \"0.0\", \"rev\": \"workspace\"}]}, \"title\": \"dvclive/plots/metrics/atemp.tsv\", \"width\": 300, \"height\": 300, \"params\": [{\"name\": \"smooth\", \"value\": 0.001, \"bind\": {\"input\": \"range\", \"min\": 0.001, \"max\": 1, \"step\": 0.001}}], \"layer\": [{\"mark\": \"line\", \"encoding\": {\"x\": {\"field\": \"step\", \"type\": \"quantitative\", \"title\": \"step\"}, \"y\": {\"field\": \"atemp\", \"type\": \"quantitative\", \"title\": \"atemp\", \"scale\": {\"zero\": false}}, \"color\": {\"field\": \"rev\", \"type\": \"nominal\"}, \"tooltip\": [{\"field\": \"step\", \"title\": \"step\", \"type\": \"quantitative\"}, {\"field\": \"atemp\", \"title\": \"atemp\", \"type\": \"quantitative\"}]}, \"transform\": [{\"loess\": \"atemp\", \"on\": \"step\", \"groupby\": [\"rev\", \"filename\", \"field\", \"filename::field\"], \"bandwidth\": {\"signal\": \"smooth\"}}]}, {\"mark\": {\"type\": \"line\", \"opacity\": 0.2}, \"encoding\": {\"x\": {\"field\": \"step\", \"type\": \"quantitative\", \"title\": \"step\"}, \"y\": {\"field\": \"atemp\", \"type\": \"quantitative\", \"title\": \"atemp\", \"scale\": {\"zero\": false}}, \"color\": {\"field\": \"rev\", \"type\": \"nominal\"}, \"tooltip\": [{\"field\": \"step\", \"title\": \"step\", \"type\": \"quantitative\"}, {\"field\": \"atemp\", \"title\": \"atemp\", \"type\": \"quantitative\"}]}}, {\"mark\": {\"type\": \"circle\", \"size\": 10, \"tooltip\": {\"content\": \"encoding\"}}, \"encoding\": {\"x\": {\"aggregate\": \"max\", \"field\": \"step\", \"type\": \"quantitative\", \"title\": \"step\"}, \"y\": {\"aggregate\": {\"argmax\": \"step\"}, \"field\": \"atemp\", \"type\": \"quantitative\", \"title\": \"atemp\", \"scale\": {\"zero\": false}}, \"color\": {\"field\": \"rev\", \"type\": \"nominal\"}}}]};\n",
              "            vegaEmbed('#dvclive_plots_metrics_atemp_tsv', spec);\n",
              "        </script>\n",
              "    </div>\n",
              "    \n",
              "\n",
              "    <div id = \"dvclive_plots_metrics_holiday_tsv\">\n",
              "        <script type = \"text/javascript\">\n",
              "            var spec = {\"$schema\": \"https://vega.github.io/schema/vega-lite/v5.json\", \"data\": {\"values\": [{\"step\": \"0\", \"holiday\": \"0.98\", \"rev\": \"workspace\"}, {\"step\": \"1\", \"holiday\": \"0.545\", \"rev\": \"workspace\"}, {\"step\": \"2\", \"holiday\": \"0.588\", \"rev\": \"workspace\"}, {\"step\": \"3\", \"holiday\": \"0.275\", \"rev\": \"workspace\"}]}, \"title\": \"dvclive/plots/metrics/holiday.tsv\", \"width\": 300, \"height\": 300, \"params\": [{\"name\": \"smooth\", \"value\": 0.001, \"bind\": {\"input\": \"range\", \"min\": 0.001, \"max\": 1, \"step\": 0.001}}], \"layer\": [{\"mark\": \"line\", \"encoding\": {\"x\": {\"field\": \"step\", \"type\": \"quantitative\", \"title\": \"step\"}, \"y\": {\"field\": \"holiday\", \"type\": \"quantitative\", \"title\": \"holiday\", \"scale\": {\"zero\": false}}, \"color\": {\"field\": \"rev\", \"type\": \"nominal\"}, \"tooltip\": [{\"field\": \"step\", \"title\": \"step\", \"type\": \"quantitative\"}, {\"field\": \"holiday\", \"title\": \"holiday\", \"type\": \"quantitative\"}]}, \"transform\": [{\"loess\": \"holiday\", \"on\": \"step\", \"groupby\": [\"rev\", \"filename\", \"field\", \"filename::field\"], \"bandwidth\": {\"signal\": \"smooth\"}}]}, {\"mark\": {\"type\": \"line\", \"opacity\": 0.2}, \"encoding\": {\"x\": {\"field\": \"step\", \"type\": \"quantitative\", \"title\": \"step\"}, \"y\": {\"field\": \"holiday\", \"type\": \"quantitative\", \"title\": \"holiday\", \"scale\": {\"zero\": false}}, \"color\": {\"field\": \"rev\", \"type\": \"nominal\"}, \"tooltip\": [{\"field\": \"step\", \"title\": \"step\", \"type\": \"quantitative\"}, {\"field\": \"holiday\", \"title\": \"holiday\", \"type\": \"quantitative\"}]}}, {\"mark\": {\"type\": \"circle\", \"size\": 10, \"tooltip\": {\"content\": \"encoding\"}}, \"encoding\": {\"x\": {\"aggregate\": \"max\", \"field\": \"step\", \"type\": \"quantitative\", \"title\": \"step\"}, \"y\": {\"aggregate\": {\"argmax\": \"step\"}, \"field\": \"holiday\", \"type\": \"quantitative\", \"title\": \"holiday\", \"scale\": {\"zero\": false}}, \"color\": {\"field\": \"rev\", \"type\": \"nominal\"}}}]};\n",
              "            vegaEmbed('#dvclive_plots_metrics_holiday_tsv', spec);\n",
              "        </script>\n",
              "    </div>\n",
              "    \n",
              "\n",
              "    <div id = \"dvclive_plots_metrics_hum_tsv\">\n",
              "        <script type = \"text/javascript\">\n",
              "            var spec = {\"$schema\": \"https://vega.github.io/schema/vega-lite/v5.json\", \"data\": {\"values\": [{\"step\": \"0\", \"hum\": \"1.0\", \"rev\": \"workspace\"}, {\"step\": \"1\", \"hum\": \"0.03\", \"rev\": \"workspace\"}, {\"step\": \"2\", \"hum\": \"0.684\", \"rev\": \"workspace\"}, {\"step\": \"3\", \"hum\": \"0.062\", \"rev\": \"workspace\"}]}, \"title\": \"dvclive/plots/metrics/hum.tsv\", \"width\": 300, \"height\": 300, \"params\": [{\"name\": \"smooth\", \"value\": 0.001, \"bind\": {\"input\": \"range\", \"min\": 0.001, \"max\": 1, \"step\": 0.001}}], \"layer\": [{\"mark\": \"line\", \"encoding\": {\"x\": {\"field\": \"step\", \"type\": \"quantitative\", \"title\": \"step\"}, \"y\": {\"field\": \"hum\", \"type\": \"quantitative\", \"title\": \"hum\", \"scale\": {\"zero\": false}}, \"color\": {\"field\": \"rev\", \"type\": \"nominal\"}, \"tooltip\": [{\"field\": \"step\", \"title\": \"step\", \"type\": \"quantitative\"}, {\"field\": \"hum\", \"title\": \"hum\", \"type\": \"quantitative\"}]}, \"transform\": [{\"loess\": \"hum\", \"on\": \"step\", \"groupby\": [\"rev\", \"filename\", \"field\", \"filename::field\"], \"bandwidth\": {\"signal\": \"smooth\"}}]}, {\"mark\": {\"type\": \"line\", \"opacity\": 0.2}, \"encoding\": {\"x\": {\"field\": \"step\", \"type\": \"quantitative\", \"title\": \"step\"}, \"y\": {\"field\": \"hum\", \"type\": \"quantitative\", \"title\": \"hum\", \"scale\": {\"zero\": false}}, \"color\": {\"field\": \"rev\", \"type\": \"nominal\"}, \"tooltip\": [{\"field\": \"step\", \"title\": \"step\", \"type\": \"quantitative\"}, {\"field\": \"hum\", \"title\": \"hum\", \"type\": \"quantitative\"}]}}, {\"mark\": {\"type\": \"circle\", \"size\": 10, \"tooltip\": {\"content\": \"encoding\"}}, \"encoding\": {\"x\": {\"aggregate\": \"max\", \"field\": \"step\", \"type\": \"quantitative\", \"title\": \"step\"}, \"y\": {\"aggregate\": {\"argmax\": \"step\"}, \"field\": \"hum\", \"type\": \"quantitative\", \"title\": \"hum\", \"scale\": {\"zero\": false}}, \"color\": {\"field\": \"rev\", \"type\": \"nominal\"}}}]};\n",
              "            vegaEmbed('#dvclive_plots_metrics_hum_tsv', spec);\n",
              "        </script>\n",
              "    </div>\n",
              "    \n",
              "\n",
              "    <div id = \"dvclive_plots_metrics_temp_tsv\">\n",
              "        <script type = \"text/javascript\">\n",
              "            var spec = {\"$schema\": \"https://vega.github.io/schema/vega-lite/v5.json\", \"data\": {\"values\": [{\"step\": \"0\", \"temp\": \"1.0\", \"rev\": \"workspace\"}, {\"step\": \"1\", \"temp\": \"0.098\", \"rev\": \"workspace\"}, {\"step\": \"2\", \"temp\": \"0.399\", \"rev\": \"workspace\"}, {\"step\": \"3\", \"temp\": \"0.0\", \"rev\": \"workspace\"}]}, \"title\": \"dvclive/plots/metrics/temp.tsv\", \"width\": 300, \"height\": 300, \"params\": [{\"name\": \"smooth\", \"value\": 0.001, \"bind\": {\"input\": \"range\", \"min\": 0.001, \"max\": 1, \"step\": 0.001}}], \"layer\": [{\"mark\": \"line\", \"encoding\": {\"x\": {\"field\": \"step\", \"type\": \"quantitative\", \"title\": \"step\"}, \"y\": {\"field\": \"temp\", \"type\": \"quantitative\", \"title\": \"temp\", \"scale\": {\"zero\": false}}, \"color\": {\"field\": \"rev\", \"type\": \"nominal\"}, \"tooltip\": [{\"field\": \"step\", \"title\": \"step\", \"type\": \"quantitative\"}, {\"field\": \"temp\", \"title\": \"temp\", \"type\": \"quantitative\"}]}, \"transform\": [{\"loess\": \"temp\", \"on\": \"step\", \"groupby\": [\"rev\", \"filename\", \"field\", \"filename::field\"], \"bandwidth\": {\"signal\": \"smooth\"}}]}, {\"mark\": {\"type\": \"line\", \"opacity\": 0.2}, \"encoding\": {\"x\": {\"field\": \"step\", \"type\": \"quantitative\", \"title\": \"step\"}, \"y\": {\"field\": \"temp\", \"type\": \"quantitative\", \"title\": \"temp\", \"scale\": {\"zero\": false}}, \"color\": {\"field\": \"rev\", \"type\": \"nominal\"}, \"tooltip\": [{\"field\": \"step\", \"title\": \"step\", \"type\": \"quantitative\"}, {\"field\": \"temp\", \"title\": \"temp\", \"type\": \"quantitative\"}]}}, {\"mark\": {\"type\": \"circle\", \"size\": 10, \"tooltip\": {\"content\": \"encoding\"}}, \"encoding\": {\"x\": {\"aggregate\": \"max\", \"field\": \"step\", \"type\": \"quantitative\", \"title\": \"step\"}, \"y\": {\"aggregate\": {\"argmax\": \"step\"}, \"field\": \"temp\", \"type\": \"quantitative\", \"title\": \"temp\", \"scale\": {\"zero\": false}}, \"color\": {\"field\": \"rev\", \"type\": \"nominal\"}}}]};\n",
              "            vegaEmbed('#dvclive_plots_metrics_temp_tsv', spec);\n",
              "        </script>\n",
              "    </div>\n",
              "    \n",
              "\n",
              "    <div id = \"dvclive_plots_metrics_weathersit_tsv\">\n",
              "        <script type = \"text/javascript\">\n",
              "            var spec = {\"$schema\": \"https://vega.github.io/schema/vega-lite/v5.json\", \"data\": {\"values\": [{\"step\": \"0\", \"weathersit\": \"0.985\", \"rev\": \"workspace\"}, {\"step\": \"1\", \"weathersit\": \"0.779\", \"rev\": \"workspace\"}, {\"step\": \"2\", \"weathersit\": \"0.155\", \"rev\": \"workspace\"}, {\"step\": \"3\", \"weathersit\": \"0.231\", \"rev\": \"workspace\"}]}, \"title\": \"dvclive/plots/metrics/weathersit.tsv\", \"width\": 300, \"height\": 300, \"params\": [{\"name\": \"smooth\", \"value\": 0.001, \"bind\": {\"input\": \"range\", \"min\": 0.001, \"max\": 1, \"step\": 0.001}}], \"layer\": [{\"mark\": \"line\", \"encoding\": {\"x\": {\"field\": \"step\", \"type\": \"quantitative\", \"title\": \"step\"}, \"y\": {\"field\": \"weathersit\", \"type\": \"quantitative\", \"title\": \"weathersit\", \"scale\": {\"zero\": false}}, \"color\": {\"field\": \"rev\", \"type\": \"nominal\"}, \"tooltip\": [{\"field\": \"step\", \"title\": \"step\", \"type\": \"quantitative\"}, {\"field\": \"weathersit\", \"title\": \"weathersit\", \"type\": \"quantitative\"}]}, \"transform\": [{\"loess\": \"weathersit\", \"on\": \"step\", \"groupby\": [\"rev\", \"filename\", \"field\", \"filename::field\"], \"bandwidth\": {\"signal\": \"smooth\"}}]}, {\"mark\": {\"type\": \"line\", \"opacity\": 0.2}, \"encoding\": {\"x\": {\"field\": \"step\", \"type\": \"quantitative\", \"title\": \"step\"}, \"y\": {\"field\": \"weathersit\", \"type\": \"quantitative\", \"title\": \"weathersit\", \"scale\": {\"zero\": false}}, \"color\": {\"field\": \"rev\", \"type\": \"nominal\"}, \"tooltip\": [{\"field\": \"step\", \"title\": \"step\", \"type\": \"quantitative\"}, {\"field\": \"weathersit\", \"title\": \"weathersit\", \"type\": \"quantitative\"}]}}, {\"mark\": {\"type\": \"circle\", \"size\": 10, \"tooltip\": {\"content\": \"encoding\"}}, \"encoding\": {\"x\": {\"aggregate\": \"max\", \"field\": \"step\", \"type\": \"quantitative\", \"title\": \"step\"}, \"y\": {\"aggregate\": {\"argmax\": \"step\"}, \"field\": \"weathersit\", \"type\": \"quantitative\", \"title\": \"weathersit\", \"scale\": {\"zero\": false}}, \"color\": {\"field\": \"rev\", \"type\": \"nominal\"}}}]};\n",
              "            vegaEmbed('#dvclive_plots_metrics_weathersit_tsv', spec);\n",
              "        </script>\n",
              "    </div>\n",
              "    \n",
              "\n",
              "    <div id = \"dvclive_plots_metrics_windspeed_tsv\">\n",
              "        <script type = \"text/javascript\">\n",
              "            var spec = {\"$schema\": \"https://vega.github.io/schema/vega-lite/v5.json\", \"data\": {\"values\": [{\"step\": \"0\", \"windspeed\": \"1.0\", \"rev\": \"workspace\"}, {\"step\": \"1\", \"windspeed\": \"0.171\", \"rev\": \"workspace\"}, {\"step\": \"2\", \"windspeed\": \"0.611\", \"rev\": \"workspace\"}, {\"step\": \"3\", \"windspeed\": \"0.012\", \"rev\": \"workspace\"}]}, \"title\": \"dvclive/plots/metrics/windspeed.tsv\", \"width\": 300, \"height\": 300, \"params\": [{\"name\": \"smooth\", \"value\": 0.001, \"bind\": {\"input\": \"range\", \"min\": 0.001, \"max\": 1, \"step\": 0.001}}], \"layer\": [{\"mark\": \"line\", \"encoding\": {\"x\": {\"field\": \"step\", \"type\": \"quantitative\", \"title\": \"step\"}, \"y\": {\"field\": \"windspeed\", \"type\": \"quantitative\", \"title\": \"windspeed\", \"scale\": {\"zero\": false}}, \"color\": {\"field\": \"rev\", \"type\": \"nominal\"}, \"tooltip\": [{\"field\": \"step\", \"title\": \"step\", \"type\": \"quantitative\"}, {\"field\": \"windspeed\", \"title\": \"windspeed\", \"type\": \"quantitative\"}]}, \"transform\": [{\"loess\": \"windspeed\", \"on\": \"step\", \"groupby\": [\"rev\", \"filename\", \"field\", \"filename::field\"], \"bandwidth\": {\"signal\": \"smooth\"}}]}, {\"mark\": {\"type\": \"line\", \"opacity\": 0.2}, \"encoding\": {\"x\": {\"field\": \"step\", \"type\": \"quantitative\", \"title\": \"step\"}, \"y\": {\"field\": \"windspeed\", \"type\": \"quantitative\", \"title\": \"windspeed\", \"scale\": {\"zero\": false}}, \"color\": {\"field\": \"rev\", \"type\": \"nominal\"}, \"tooltip\": [{\"field\": \"step\", \"title\": \"step\", \"type\": \"quantitative\"}, {\"field\": \"windspeed\", \"title\": \"windspeed\", \"type\": \"quantitative\"}]}}, {\"mark\": {\"type\": \"circle\", \"size\": 10, \"tooltip\": {\"content\": \"encoding\"}}, \"encoding\": {\"x\": {\"aggregate\": \"max\", \"field\": \"step\", \"type\": \"quantitative\", \"title\": \"step\"}, \"y\": {\"aggregate\": {\"argmax\": \"step\"}, \"field\": \"windspeed\", \"type\": \"quantitative\", \"title\": \"windspeed\", \"scale\": {\"zero\": false}}, \"color\": {\"field\": \"rev\", \"type\": \"nominal\"}}}]};\n",
              "            vegaEmbed('#dvclive_plots_metrics_windspeed_tsv', spec);\n",
              "        </script>\n",
              "    </div>\n",
              "    \n",
              "\n",
              "    <div id = \"dvclive_plots_metrics_workingday_tsv\">\n",
              "        <script type = \"text/javascript\">\n",
              "            var spec = {\"$schema\": \"https://vega.github.io/schema/vega-lite/v5.json\", \"data\": {\"values\": [{\"step\": \"0\", \"workingday\": \"0.851\", \"rev\": \"workspace\"}, {\"step\": \"1\", \"workingday\": \"0.653\", \"rev\": \"workspace\"}, {\"step\": \"2\", \"workingday\": \"0.699\", \"rev\": \"workspace\"}, {\"step\": \"3\", \"workingday\": \"0.593\", \"rev\": \"workspace\"}]}, \"title\": \"dvclive/plots/metrics/workingday.tsv\", \"width\": 300, \"height\": 300, \"params\": [{\"name\": \"smooth\", \"value\": 0.001, \"bind\": {\"input\": \"range\", \"min\": 0.001, \"max\": 1, \"step\": 0.001}}], \"layer\": [{\"mark\": \"line\", \"encoding\": {\"x\": {\"field\": \"step\", \"type\": \"quantitative\", \"title\": \"step\"}, \"y\": {\"field\": \"workingday\", \"type\": \"quantitative\", \"title\": \"workingday\", \"scale\": {\"zero\": false}}, \"color\": {\"field\": \"rev\", \"type\": \"nominal\"}, \"tooltip\": [{\"field\": \"step\", \"title\": \"step\", \"type\": \"quantitative\"}, {\"field\": \"workingday\", \"title\": \"workingday\", \"type\": \"quantitative\"}]}, \"transform\": [{\"loess\": \"workingday\", \"on\": \"step\", \"groupby\": [\"rev\", \"filename\", \"field\", \"filename::field\"], \"bandwidth\": {\"signal\": \"smooth\"}}]}, {\"mark\": {\"type\": \"line\", \"opacity\": 0.2}, \"encoding\": {\"x\": {\"field\": \"step\", \"type\": \"quantitative\", \"title\": \"step\"}, \"y\": {\"field\": \"workingday\", \"type\": \"quantitative\", \"title\": \"workingday\", \"scale\": {\"zero\": false}}, \"color\": {\"field\": \"rev\", \"type\": \"nominal\"}, \"tooltip\": [{\"field\": \"step\", \"title\": \"step\", \"type\": \"quantitative\"}, {\"field\": \"workingday\", \"title\": \"workingday\", \"type\": \"quantitative\"}]}}, {\"mark\": {\"type\": \"circle\", \"size\": 10, \"tooltip\": {\"content\": \"encoding\"}}, \"encoding\": {\"x\": {\"aggregate\": \"max\", \"field\": \"step\", \"type\": \"quantitative\", \"title\": \"step\"}, \"y\": {\"aggregate\": {\"argmax\": \"step\"}, \"field\": \"workingday\", \"type\": \"quantitative\", \"title\": \"workingday\", \"scale\": {\"zero\": false}}, \"color\": {\"field\": \"rev\", \"type\": \"nominal\"}}}]};\n",
              "            vegaEmbed('#dvclive_plots_metrics_workingday_tsv', spec);\n",
              "        </script>\n",
              "    </div>\n",
              "    \n",
              "</body>\n",
              "</html>"
            ]
          },
          "metadata": {},
          "execution_count": 16
        }
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "## In multiple experiments (one per step)"
      ],
      "metadata": {
        "id": "CCdF_ipAIY7k"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "# Setup a git repo with dvc\n",
        "\n",
        "%cd /content\n",
        "!rm -rf experiments && mkdir experiments\n",
        "%cd experiments\n",
        "\n",
        "!git init\n",
        "!git add .gitignore\n",
        "!git commit -m \"Init repo\"\n",
        "!dvc init\n",
        "!git commit -m \"Init DVC\""
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "0x81BAI--2Gm",
        "executionInfo": {
          "status": "ok",
          "timestamp": 1697468159295,
          "user_tz": -120,
          "elapsed": 1213,
          "user": {
            "displayName": "Francesco Motoko",
            "userId": "00974636158007469548"
          }
        },
        "outputId": "7fb22cea-d367-41b0-f27d-a99e9d6081dc"
      },
      "execution_count": 17,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "/content\n",
            "/content/experiments\n",
            "hint: Using 'master' as the name for the initial branch. This default branch name\n",
            "hint: is subject to change. To configure the initial branch name to use in all\n",
            "hint: of your new repositories, which will suppress this warning, call:\n",
            "hint: \n",
            "hint: \tgit config --global init.defaultBranch <name>\n",
            "hint: \n",
            "hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and\n",
            "hint: 'development'. The just-created branch can be renamed via this command:\n",
            "hint: \n",
            "hint: \tgit branch -m <name>\n",
            "Initialized empty Git repository in /content/experiments/.git/\n",
            "fatal: pathspec '.gitignore' did not match any files\n",
            "On branch master\n",
            "\n",
            "Initial commit\n",
            "\n",
            "nothing to commit (create/copy files and use \"git add\" to track)\n",
            "Initialized DVC repository.\n",
            "\n",
            "You can now commit the changes to git.\n",
            "\n",
            "+---------------------------------------------------------------------+\n",
            "|                                                                     |\n",
            "|        DVC has enabled anonymous aggregate usage analytics.         |\n",
            "|     Read the analytics documentation (and how to opt-out) here:     |\n",
            "|             <https://dvc.org/doc/user-guide/analytics>              |\n",
            "|                                                                     |\n",
            "+---------------------------------------------------------------------+\n",
            "\n",
            "What's next?\n",
            "------------\n",
            "- Check out the documentation: <https://dvc.org/doc>\n",
            "- Get help and share ideas: <https://dvc.org/chat>\n",
            "- Star us on GitHub: <https://github.com/iterative/dvc>\n",
            "[master (root-commit) 469083d] Init DVC\n",
            " 3 files changed, 6 insertions(+)\n",
            " create mode 100644 .dvc/.gitignore\n",
            " create mode 100644 .dvc/config\n",
            " create mode 100644 .dvcignore\n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "from dvclive import Live\n",
        "\n",
        "for step, date in enumerate(experiment_batches):\n",
        "    with Live() as live:\n",
        "        live.log_param(\"step\", step)\n",
        "        live.log_param(\"begin\", date[0])\n",
        "        live.log_param(\"end\", date[1])\n",
        "\n",
        "        metrics = eval_drift(\n",
        "            df.loc[df.dteday.between(reference_dates[0], reference_dates[1])],\n",
        "            df.loc[df.dteday.between(date[0], date[1])],\n",
        "            column_mapping=data_columns,\n",
        "        )\n",
        "\n",
        "        for feature in metrics:\n",
        "            live.log_metric(feature[0], round(feature[1], 3))\n"
      ],
      "metadata": {
        "id": "VfVLDwfD39qO",
        "executionInfo": {
          "status": "ok",
          "timestamp": 1697468161649,
          "user_tz": -120,
          "elapsed": 2355,
          "user": {
            "displayName": "Francesco Motoko",
            "userId": "00974636158007469548"
          }
        }
      },
      "execution_count": 18,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "import dvc.api\n",
        "\n",
        "pd.DataFrame(dvc.api.exp_show())"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 238
        },
        "id": "ijcN3PaZ6fM0",
        "executionInfo": {
          "status": "ok",
          "timestamp": 1697468162078,
          "user_tz": -120,
          "elapsed": 433,
          "user": {
            "displayName": "Francesco Motoko",
            "userId": "00974636158007469548"
          }
        },
        "outputId": "2d26f834-604f-4e28-8924-f5d97ae92596"
      },
      "execution_count": 19,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "   Experiment        rev            typ   Created parent State Executor  \\\n",
              "0        None  workspace       baseline      None   None  None     None   \n",
              "1        None     master       baseline  02:55 PM   None  None     None   \n",
              "2  elite-mobs    e4d6acd  branch_commit  02:56 PM   None  None     None   \n",
              "3  buxom-shes    439f6e1  branch_commit  02:56 PM   None  None     None   \n",
              "4  hammy-skip    b5b80b5  branch_commit  02:55 PM   None  None     None   \n",
              "5  girly-sere    2ba9568    branch_base  02:55 PM   None  None     None   \n",
              "\n",
              "   weathersit   temp  atemp    hum  windspeed  holiday  workingday  step  \\\n",
              "0       0.231    NaN    NaN  0.062      0.012    0.275       0.593   3.0   \n",
              "1         NaN    NaN    NaN    NaN        NaN      NaN         NaN   NaN   \n",
              "2       0.231    NaN    NaN  0.062      0.012    0.275       0.593   3.0   \n",
              "3       0.155  0.399  0.537  0.684      0.611    0.588       0.699   2.0   \n",
              "4       0.985  1.000  1.000  1.000      1.000    0.980       0.851   NaN   \n",
              "5       0.779  0.098  0.107  0.030      0.171    0.545       0.653   1.0   \n",
              "\n",
              "                 begin                  end  \n",
              "0  2011-02-15 00:00:00  2011-02-21 23:00:00  \n",
              "1                 None                 None  \n",
              "2  2011-02-15 00:00:00  2011-02-21 23:00:00  \n",
              "3  2011-02-07 00:00:00  2011-02-14 23:00:00  \n",
              "4  2011-01-01 00:00:00  2011-01-29 23:00:00  \n",
              "5  2011-01-29 00:00:00  2011-02-07 23:00:00  "
            ],
            "text/html": [
              "\n",
              "  <div id=\"df-8c0d1ac2-fd6a-4e45-909c-a1c7a643c0ff\" class=\"colab-df-container\">\n",
              "    <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>Experiment</th>\n",
              "      <th>rev</th>\n",
              "      <th>typ</th>\n",
              "      <th>Created</th>\n",
              "      <th>parent</th>\n",
              "      <th>State</th>\n",
              "      <th>Executor</th>\n",
              "      <th>weathersit</th>\n",
              "      <th>temp</th>\n",
              "      <th>atemp</th>\n",
              "      <th>hum</th>\n",
              "      <th>windspeed</th>\n",
              "      <th>holiday</th>\n",
              "      <th>workingday</th>\n",
              "      <th>step</th>\n",
              "      <th>begin</th>\n",
              "      <th>end</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>None</td>\n",
              "      <td>workspace</td>\n",
              "      <td>baseline</td>\n",
              "      <td>None</td>\n",
              "      <td>None</td>\n",
              "      <td>None</td>\n",
              "      <td>None</td>\n",
              "      <td>0.231</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>0.062</td>\n",
              "      <td>0.012</td>\n",
              "      <td>0.275</td>\n",
              "      <td>0.593</td>\n",
              "      <td>3.0</td>\n",
              "      <td>2011-02-15 00:00:00</td>\n",
              "      <td>2011-02-21 23:00:00</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>None</td>\n",
              "      <td>master</td>\n",
              "      <td>baseline</td>\n",
              "      <td>02:55 PM</td>\n",
              "      <td>None</td>\n",
              "      <td>None</td>\n",
              "      <td>None</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>None</td>\n",
              "      <td>None</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>elite-mobs</td>\n",
              "      <td>e4d6acd</td>\n",
              "      <td>branch_commit</td>\n",
              "      <td>02:56 PM</td>\n",
              "      <td>None</td>\n",
              "      <td>None</td>\n",
              "      <td>None</td>\n",
              "      <td>0.231</td>\n",
              "      <td>NaN</td>\n",
              "      <td>NaN</td>\n",
              "      <td>0.062</td>\n",
              "      <td>0.012</td>\n",
              "      <td>0.275</td>\n",
              "      <td>0.593</td>\n",
              "      <td>3.0</td>\n",
              "      <td>2011-02-15 00:00:00</td>\n",
              "      <td>2011-02-21 23:00:00</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>buxom-shes</td>\n",
              "      <td>439f6e1</td>\n",
              "      <td>branch_commit</td>\n",
              "      <td>02:56 PM</td>\n",
              "      <td>None</td>\n",
              "      <td>None</td>\n",
              "      <td>None</td>\n",
              "      <td>0.155</td>\n",
              "      <td>0.399</td>\n",
              "      <td>0.537</td>\n",
              "      <td>0.684</td>\n",
              "      <td>0.611</td>\n",
              "      <td>0.588</td>\n",
              "      <td>0.699</td>\n",
              "      <td>2.0</td>\n",
              "      <td>2011-02-07 00:00:00</td>\n",
              "      <td>2011-02-14 23:00:00</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>hammy-skip</td>\n",
              "      <td>b5b80b5</td>\n",
              "      <td>branch_commit</td>\n",
              "      <td>02:55 PM</td>\n",
              "      <td>None</td>\n",
              "      <td>None</td>\n",
              "      <td>None</td>\n",
              "      <td>0.985</td>\n",
              "      <td>1.000</td>\n",
              "      <td>1.000</td>\n",
              "      <td>1.000</td>\n",
              "      <td>1.000</td>\n",
              "      <td>0.980</td>\n",
              "      <td>0.851</td>\n",
              "      <td>NaN</td>\n",
              "      <td>2011-01-01 00:00:00</td>\n",
              "      <td>2011-01-29 23:00:00</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>5</th>\n",
              "      <td>girly-sere</td>\n",
              "      <td>2ba9568</td>\n",
              "      <td>branch_base</td>\n",
              "      <td>02:55 PM</td>\n",
              "      <td>None</td>\n",
              "      <td>None</td>\n",
              "      <td>None</td>\n",
              "      <td>0.779</td>\n",
              "      <td>0.098</td>\n",
              "      <td>0.107</td>\n",
              "      <td>0.030</td>\n",
              "      <td>0.171</td>\n",
              "      <td>0.545</td>\n",
              "      <td>0.653</td>\n",
              "      <td>1.0</td>\n",
              "      <td>2011-01-29 00:00:00</td>\n",
              "      <td>2011-02-07 23:00:00</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>\n",
              "    <div class=\"colab-df-buttons\">\n",
              "\n",
              "  <div class=\"colab-df-container\">\n",
              "    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-8c0d1ac2-fd6a-4e45-909c-a1c7a643c0ff')\"\n",
              "            title=\"Convert this dataframe to an interactive table.\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n",
              "    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n",
              "  </svg>\n",
              "    </button>\n",
              "\n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    .colab-df-buttons div {\n",
              "      margin-bottom: 4px;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "    <script>\n",
              "      const buttonEl =\n",
              "        document.querySelector('#df-8c0d1ac2-fd6a-4e45-909c-a1c7a643c0ff button.colab-df-convert');\n",
              "      buttonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "      async function convertToInteractive(key) {\n",
              "        const element = document.querySelector('#df-8c0d1ac2-fd6a-4e45-909c-a1c7a643c0ff');\n",
              "        const dataTable =\n",
              "          await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                    [key], {});\n",
              "        if (!dataTable) return;\n",
              "\n",
              "        const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "          + ' to learn more about interactive tables.';\n",
              "        element.innerHTML = '';\n",
              "        dataTable['output_type'] = 'display_data';\n",
              "        await google.colab.output.renderOutput(dataTable, element);\n",
              "        const docLink = document.createElement('div');\n",
              "        docLink.innerHTML = docLinkHtml;\n",
              "        element.appendChild(docLink);\n",
              "      }\n",
              "    </script>\n",
              "  </div>\n",
              "\n",
              "\n",
              "<div id=\"df-34c6bd2a-95f3-454a-a096-42c68cda98fb\">\n",
              "  <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-34c6bd2a-95f3-454a-a096-42c68cda98fb')\"\n",
              "            title=\"Suggest charts.\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "     width=\"24px\">\n",
              "    <g>\n",
              "        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n",
              "    </g>\n",
              "</svg>\n",
              "  </button>\n",
              "\n",
              "<style>\n",
              "  .colab-df-quickchart {\n",
              "      --bg-color: #E8F0FE;\n",
              "      --fill-color: #1967D2;\n",
              "      --hover-bg-color: #E2EBFA;\n",
              "      --hover-fill-color: #174EA6;\n",
              "      --disabled-fill-color: #AAA;\n",
              "      --disabled-bg-color: #DDD;\n",
              "  }\n",
              "\n",
              "  [theme=dark] .colab-df-quickchart {\n",
              "      --bg-color: #3B4455;\n",
              "      --fill-color: #D2E3FC;\n",
              "      --hover-bg-color: #434B5C;\n",
              "      --hover-fill-color: #FFFFFF;\n",
              "      --disabled-bg-color: #3B4455;\n",
              "      --disabled-fill-color: #666;\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart {\n",
              "    background-color: var(--bg-color);\n",
              "    border: none;\n",
              "    border-radius: 50%;\n",
              "    cursor: pointer;\n",
              "    display: none;\n",
              "    fill: var(--fill-color);\n",
              "    height: 32px;\n",
              "    padding: 0;\n",
              "    width: 32px;\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart:hover {\n",
              "    background-color: var(--hover-bg-color);\n",
              "    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "    fill: var(--button-hover-fill-color);\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart-complete:disabled,\n",
              "  .colab-df-quickchart-complete:disabled:hover {\n",
              "    background-color: var(--disabled-bg-color);\n",
              "    fill: var(--disabled-fill-color);\n",
              "    box-shadow: none;\n",
              "  }\n",
              "\n",
              "  .colab-df-spinner {\n",
              "    border: 2px solid var(--fill-color);\n",
              "    border-color: transparent;\n",
              "    border-bottom-color: var(--fill-color);\n",
              "    animation:\n",
              "      spin 1s steps(1) infinite;\n",
              "  }\n",
              "\n",
              "  @keyframes spin {\n",
              "    0% {\n",
              "      border-color: transparent;\n",
              "      border-bottom-color: var(--fill-color);\n",
              "      border-left-color: var(--fill-color);\n",
              "    }\n",
              "    20% {\n",
              "      border-color: transparent;\n",
              "      border-left-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "    }\n",
              "    30% {\n",
              "      border-color: transparent;\n",
              "      border-left-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "      border-right-color: var(--fill-color);\n",
              "    }\n",
              "    40% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "    }\n",
              "    60% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "    }\n",
              "    80% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "      border-bottom-color: var(--fill-color);\n",
              "    }\n",
              "    90% {\n",
              "      border-color: transparent;\n",
              "      border-bottom-color: var(--fill-color);\n",
              "    }\n",
              "  }\n",
              "</style>\n",
              "\n",
              "  <script>\n",
              "    async function quickchart(key) {\n",
              "      const quickchartButtonEl =\n",
              "        document.querySelector('#' + key + ' button');\n",
              "      quickchartButtonEl.disabled = true;  // To prevent multiple clicks.\n",
              "      quickchartButtonEl.classList.add('colab-df-spinner');\n",
              "      try {\n",
              "        const charts = await google.colab.kernel.invokeFunction(\n",
              "            'suggestCharts', [key], {});\n",
              "      } catch (error) {\n",
              "        console.error('Error during call to suggestCharts:', error);\n",
              "      }\n",
              "      quickchartButtonEl.classList.remove('colab-df-spinner');\n",
              "      quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n",
              "    }\n",
              "    (() => {\n",
              "      let quickchartButtonEl =\n",
              "        document.querySelector('#df-34c6bd2a-95f3-454a-a096-42c68cda98fb button');\n",
              "      quickchartButtonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "    })();\n",
              "  </script>\n",
              "</div>\n",
              "    </div>\n",
              "  </div>\n"
            ]
          },
          "metadata": {},
          "execution_count": 19
        }
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "To explore the results from CLI:"
      ],
      "metadata": {
        "id": "TQE5aBWl-sef"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "!dvc exp show"
      ],
      "metadata": {
        "id": "oZtY-97bQj-Q",
        "executionInfo": {
          "status": "ok",
          "timestamp": 1697468163295,
          "user_tz": -120,
          "elapsed": 1221,
          "user": {
            "displayName": "Francesco Motoko",
            "userId": "00974636158007469548"
          }
        },
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "outputId": "14eb8d4c-c9ce-4bb8-caba-42e46d45bb65"
      },
      "execution_count": 20,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            " ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── \n",
            "  Experiment                 Created    weathersit    temp   atemp     hum   windspeed   holiday   workingday   step   begin                 end                  \n",
            " ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── \n",
            "  workspace                  -               0.231       0       0   0.062       0.012     0.275        0.593   3      2011-02-15 00:00:00   2011-02-21 23:00:00  \n",
            "  master                     02:55 PM            -       -       -       -           -         -            -   -      -                     -                    \n",
            "  ├── e4d6acd [elite-mobs]   02:56 PM        0.231       0       0   0.062       0.012     0.275        0.593   3      2011-02-15 00:00:00   2011-02-21 23:00:00  \n",
            "  ├── 439f6e1 [buxom-shes]   02:56 PM        0.155   0.399   0.537   0.684       0.611     0.588        0.699   2      2011-02-07 00:00:00   2011-02-14 23:00:00  \n",
            "  ├── b5b80b5 [hammy-skip]   02:55 PM        0.985       1       1       1           1      0.98        0.851   0      2011-01-01 00:00:00   2011-01-29 23:00:00  \n",
            "  └── 2ba9568 [girly-sere]   02:55 PM        0.779   0.098   0.107    0.03       0.171     0.545        0.653   1      2011-01-29 00:00:00   2011-02-07 23:00:00  \n",
            " ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── \n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [],
      "metadata": {
        "id": "QoYexufp-qw2",
        "executionInfo": {
          "status": "ok",
          "timestamp": 1697468163757,
          "user_tz": -120,
          "elapsed": 464,
          "user": {
            "displayName": "Francesco Motoko",
            "userId": "00974636158007469548"
          }
        }
      },
      "execution_count": 20,
      "outputs": []
    }
  ]
}
